﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Core;
using System.Xml.Linq;

#endregion

namespace MarketPulse.Reporting.Core
{
    /// <summary>
    /// This class represents a read only reporting Answer object.
    /// </summary>
    [Serializable]    
    public class ReportingAnswerInfo : MarketPulseReadOnlyBase<ReportingAnswerInfo>
    {

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private ReportingAnswerInfo()
            {
            }

        #endregion  

        #region Properties

            /// <summary>
            /// The primary key of this answer in the database. (Unique identifier for ranking)
            /// </summary>
            public static PropertyInfo<long> AnswerIDProperty = RegisterProperty<long>(p => p.ID);
            /// <summary>
            /// The primary key of this answer in the database. (Unique identifier for ranking)
            /// </summary>
            public long ID
            {
                get { return GetProperty(AnswerIDProperty); }
            }

            /// <summary>
            /// The GUID of the visit this answer belongs to.
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> VisitGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.VisitGUID);
            /// <summary>
            /// The GUID of the visit this answer belongs to.
            /// </summary>
            public Nullable<Guid> VisitGUID
            {
                get { return GetProperty(VisitGUIDProperty); }
            }

            /// <summary>
            /// The GUID of the parent answer that this answer is related to.
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> ParentAnswerGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.ParentAnswerGUID);
            /// <summary>
            /// The GUID of the parent answer that this answer is related to.
            /// </summary>
            public Nullable<Guid> ParentAnswerGUID
            {
                get { return GetProperty(ParentAnswerGUIDProperty); }
            }

            /// <summary>
            /// The Question GUID that this answer relates to. (Unique identifier for ranking)
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> QuestionGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.QuestionGUID);
            /// <summary>
            /// The Question GUID that this answer relates to. (Unique identifier for ranking)
            /// </summary>
            public Nullable<Guid> QuestionGUID
            {
                get { return GetProperty(QuestionGUIDProperty); }
            }

            /// <summary>
            /// The type of answer this is.
            /// </summary>
            public static PropertyInfo<string> TypeProperty = RegisterProperty<string>(p => p.Type);
            /// <summary>
            /// The type of answer this is.
            /// </summary>
            public string Type
            {
                get { return GetProperty(TypeProperty); }
            }

            /// <summary>
            /// The displayed answer number for this answer.
            /// </summary>
            public static PropertyInfo<string> DisplayNumberProperty = RegisterProperty<string>(p => p.DisplayNumber);
            /// <summary>
            /// The displayed answer number for this answer.
            /// </summary>
            public string DisplayNumber
            {
                get { return GetProperty(DisplayNumberProperty); }
            }

            /// <summary>
            /// The non-displayed number for this answer.
            /// </summary>
            public static PropertyInfo<string> AnswerNumberProperty = RegisterProperty<string>(p => p.Number);
            /// <summary>
            /// The non-displayed number for this answer.
            /// </summary>
            public string Number
            {
                get { return GetProperty(AnswerNumberProperty); }
            }

            /// <summary>
            /// The text for this answer.
            /// </summary>
            public static PropertyInfo<XElement> AnswerTextProperty = RegisterProperty<XElement>(p => p.Text);
            /// <summary>
            /// The text for this answer.
            /// </summary>
            public XElement Text
            {
                get { return GetProperty(AnswerTextProperty); }
            }

            /// <summary>
            /// The score for this answer.
            /// </summary>
            public static PropertyInfo<long> AnswerScoreProperty = RegisterProperty<long>(p => p.Score);
            /// <summary>
            /// The score for this answer.
            /// </summary>
            public long Score
            {
                get { return GetProperty(AnswerScoreProperty); }
            }

            /// <summary>
            /// The actual answer given to the question.
            /// </summary>
            public static PropertyInfo<string> AnswerValueProperty = RegisterProperty<string>(p => p.Value);
            /// <summary>
            /// The actual answer given to the question.
            /// </summary>
            public string Value
            {
                get { return GetProperty(AnswerValueProperty); }
            }

            /// <summary>
            /// Whether this answer was marked as forcing actual score.
            /// </summary>
            public static PropertyInfo<bool> ForceActualScoreProperty = RegisterProperty<bool>(p => p.ForceActualScore);
            /// <summary>
            /// Whether this answer was marked as forcing actual score.
            /// </summary>
            public bool ForceActualScore
            {
                get { return GetProperty(ForceActualScoreProperty); }
            }

            /// <summary>
            /// The time this question was transferred into the reporting database.
            /// </summary>
            public static PropertyInfo<SmartDate> TransferDateTimeProperty = RegisterProperty<SmartDate>(p => p.TransferDateTime);
            /// <summary>
            /// The time this question was transferred into the reporting database.
            /// </summary>
            public SmartDate TransferDateTime
            {
                get { return GetProperty(TransferDateTimeProperty); }
            }

        #endregion

    }
}